package org.esprit.ocm.client.rpc;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public interface UserServiceAsync
{

    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.UserService
     */
    void add( org.esprit.ocm.dto.impl.UserDto _o, AsyncCallback<org.esprit.ocm.dto.impl.UserDto> callback );


    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.UserService
     */
    void fetch( AsyncCallback<java.util.List<org.esprit.ocm.dto.impl.UserDto>> callback );


    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.UserService
     */
    void remove( org.esprit.ocm.dto.impl.UserDto _o, AsyncCallback<Void> callback );


    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.UserService
     */
    void count( AsyncCallback<java.lang.Integer> callback );


    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.UserService
     */
    void authenticate( java.lang.String login, java.lang.String pass, AsyncCallback<org.esprit.ocm.dto.impl.UserDto> callback );


    /**
     * Utility class to get the RPC Async interface from client-side code
     */
    public static final class Util 
    { 
        private static UserServiceAsync instance;

        public static final UserServiceAsync getInstance()
        {
            if ( instance == null )
            {
                instance = (UserServiceAsync) GWT.create( UserService.class );
                ServiceDefTarget target = (ServiceDefTarget) instance;
                target.setServiceEntryPoint( GWT.getModuleBaseURL() + "UserService.rpc" );
            }
            return instance;
        }

        private Util()
        {
            // Utility class should not be instanciated
        }
    }
}
